package com.cq.hd.common.exception;

import com.cq.hd.common.enums.ResponseEnums;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * @description: 业务异常
 * @author: mYunYu
 * @date: 2021/7/7 15:43
 * @version: v1.0
 */
@Data
@EqualsAndHashCode(callSuper = false)
public class BusinessException extends RuntimeException{

    private int code;

    private ResponseEnums responseEnums;

    public BusinessException(ResponseEnums responseEnums) {
        super(responseEnums.getMessage());
        this.code = responseEnums.getCode();
        this.responseEnums = responseEnums;
    }

    public BusinessException(String message) {
        super(message);
        this.code = ResponseEnums.ERROR.getCode();
    }

    public BusinessException(int code, String message) {
        super(message);
        this.code = code;
    }

}
